feat(privacy): hardened recursive PII redaction and structured JSON r…#641
Conversation
…equest logging - Rewrite src/middleware/privacy-logger.ts with SENSITIVE_KEYS, PII_PATTERNS, redact<T>, maskIp, and privacyLogger emitting a flat LogLine shape - Redaction marker changed to [REDACTED]; covers email/JWT value patterns - Emit single console.log JSON line on res.finish with exact schema: timestamp, level, event, service, method, url, status, durationMs, ip, body, query, headers - Redacts authorization, x-api-key, x-auth-token, cookie headers - Error path emits safe 3-key fallback; never surfaces raw PII - Add src/tests/privacy-logger.redaction.test.ts: 41 tests + snapshot - Update docs/privacy-logging.md Closes Disciplr-Org#619
|
this is genuinely a nicer redactor than what we had — the recursive walk and the structured JSON output are the right direction. the snag is timing: #633 (the property-based redaction tests) merged just ahead of this and it pins the current contract — |
1nonlypiece
left a comment
There was a problem hiding this comment.
thanks for circling back and rebasing this — reconciling the recursive redaction with the existing tests is exactly what it needed. reads well now, merged.
…equest logging
Closes #619